package com.kefu.exam.handler;

import com.kefu.common.context.KefuContext;
import com.kefu.exam.mapper.ExamSubjectAnswerMapper;
import com.kefu.exam.mapper.ExamSubjectMapper;
import com.kefu.exam.model.ExamSubject;
import com.kefu.exam.service.ExamSubjectService;
import com.kefu.exam.vo.ExamSubjectInsertVo;
import com.kefu.exam.vo.SubjectUnit;

public interface SubjectTipHandler {
    /**
     * 题目初始化的时候执行
     *
     * @param subject
     * @param subjectAnswerMapper
     * @param examSubjectMapper
     * @param context
     */
    void subjectInitHandle(ExamSubject subject, ExamSubjectAnswerMapper subjectAnswerMapper, ExamSubjectMapper examSubjectMapper, KefuContext context);

    /**
     * 用户批量导入题后，某个类型的字符串题创建为数据库中的数据
     *
     * @return
     */
    SubjectUnit expressTextSubject(ExamSubjectInsertVo vo, String subjectTypeId, KefuContext context,
                                          ExamSubjectService subjectService, ExamSubjectAnswerMapper subjectAnswerMapper,
                                          ExamSubjectMapper subjectMapper);

    /**
     * 判断一道题是否有答案
     *
     * @param answers
     * @return
     */
//    public boolean isHaveAnswer(List<CardAnswer> answers);

    /**
     * 把一个答案填充到题中
     *
     * @param nuit
     *            题
     * @param list
     *            用户答案序列
     */
//    public void loadVal(SubjectUnit nuit, List<CardAnswer> list);

    /**
     * 计算用户答题得得分权重
     *
     * @param unit
     * @return 返回得分权重，如果得分大于100，或者小于0，则都是最终的分数
     */
    int runPointWeight(SubjectUnit unit);

    /**
     * 判斷該題是否已經配置過正确答案了
     *
     * @param answers
     *            题的答案
     * @return
     */
//    public boolean isHaveRightAnswer(List<SubjectAnswer> answers);
}
